package com.google.code.swingonfire.plotter;

import java.awt.Graphics2D;
import java.awt.Rectangle;

public class HMirrorSketch implements Sketch
{

    private final Sketch sketch;
    private final Rectangle bounds;

    public HMirrorSketch(Sketch sketch)
    {
        super();

        this.sketch = sketch;

        Rectangle originalBounds = sketch.getBounds();

        bounds =
            new Rectangle(-originalBounds.x - originalBounds.width, originalBounds.y, originalBounds.width,
                originalBounds.height);
    }

    @Override
    public Rectangle getBounds()
    {
        return bounds;
    }

    @Override
    public void draw(Graphics2D g)
    {
        g.scale(-1, 1);

        sketch.draw(g);
    }

}
